<%@page import="machine.QueryProcessor"%>
<%

    request.setCharacterEncoding("UTF-8");

    session.setAttribute("B", 0.75);            //constante
    session.setAttribute("K", 1.2);            //constante
    session.setAttribute("docsQuantity", 0);    //quantidade de documentos
    session.setAttribute("avgDocumentLenght", 0);//média de tamanho de documentos
    session.setAttribute("queryProcessor", null);//query Processor class
    session.setAttribute("documentList", null);
    session.setAttribute("query", "");        //query do usuário
    session.setAttribute("idx", 0);             //indice da página
    session.setAttribute("queryList", null);    //lista de documentos retornados na query
    session.setAttribute("queryLenght", 100);   //número de documentos retornados
    session.setAttribute("queryTime", 0);       //tempo demorado

%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="UTF-8">
        <title>Onquitá</title>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <link rel="shortcut icon" href="favicon.ico" />
        <script type="text/javascript" src="js/general.js"></script>
    </head>
    <body>
        <div class="content">
            <center>
                <img src="imgs/logo.png" class="logo" />

                <%                    machine.Batch batch = new machine.Batch();
                    if (batch.connectDB()) {
                        session.setAttribute("docsQuantity", batch.docLen());
                        session.setAttribute("avgDocumentLenght", batch.getAvgBD());
                %>

                <form action="search.jsp" method="get" id="searchInputText">
                    <input type="text" size="60" name="search" class="inputSearch" />
                    <img src="imgs/littleLupa.png" class="submitSearch" onclick="javascript: submit()" />
                </form>

                <%                    } else {
                        out.println("<h1>Erro ao conecetar ao banco de dados</h1>");
                    }
                %>

            </center>
        </div>
    </body>
</html>
